package org.dandsoft.blackbox.logger;

/**
 * User: dvilyuzhanin
 * Date: 21.01.2009 14:02:45
 */
public class MessageLevel {

    public final static MessageLevel INFO = new MessageLevel(10, "INFO");
    public final static MessageLevel ERROR = new MessageLevel(10, "ERROR");

    private int priority;
    private String levelName;

    public MessageLevel(int priority, String levelName) {
        this.levelName = levelName;
        this.priority = priority;
    }

    public String getLevelName() {
        return levelName;
    }

    public int getPriority() {
        return priority;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MessageLevel that = (MessageLevel) o;

        if (priority != that.priority) return false;
        if (levelName != null ? !levelName.equals(that.levelName) : that.levelName != null) return false;

        return true;
    }

    public int hashCode() {
        int result;
        result = priority;
        result = 31 * result + (levelName != null ? levelName.hashCode() : 0);
        return result;
    }


    public String toString() {
        return "MessageLevel{" +
               "priority=" + priority +
               ", levelName='" + levelName + '\'' +
               '}';
    }
}
